email me at borlaj@portlandschools.org

Loading
notes previous (10/<10) submit the dump links  
 

Full screen JFRAME (demo here)

 

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FullScreenJFrame extends JFrame implements ActionListener
{

    JButton closeButton = new JButton("Close");

    public static void main( String[] args )
    {
        FullScreenJFrame frame = new FullScreenJFrame();
        frame.init();
        frame.setVisible(true);
    }

    public void init()
    {
        setUndecorated(true);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setBounds(0,0,screenSize.width, screenSize.height);

        Container screen = getContentPane();
        screen.setBackground(Color.green);
        screen.setLayout (new FlowLayout() );
        screen.add(closeButton);

        closeButton.addActionListener(this);
    }

    public void actionPerformed(ActionEvent thisEvent)
    {
        Object source = thisEvent.getSource();

        if (source == closeButton)
        {           
            System.exit(0);
        }

    }

}